home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 33
/
Aminet 33 - October 1999.iso
/
Guides
/
HTML
/
amiganews.pl
< prev
next >
Wrap
Perl Script
|
1999-09-12
|
1KB
|
61 lines
#!/bin/perl
# replace amiga-news links in amiga-news page $1
#$home= "file:/usr/people/mueller/an";
#$extbeg="<font color=blue>"; $extend="</font>";
$home="file://AMINET32:Guides/HTML";
$extbeg="<i>"; $extend="</i>";
open(IN,$ARGV[0]) || die;
while (<IN>) {
#s#(<a href="http://www.kdh-datentechnik)
$line=$_;
for ($i=0; $i<length($line); $i++) {
$c=substr($line,$i,1);
if ($c ne "<") {print "$c"; next}
$_=substr($line, $i);
if (/^<a /i) {
($_)=m/^([^>]*)/;
$cgi = m#\.cgi# && !m#amiga-news.de#;
$extlink = m#http://# && !m#amiga-news.de#;
$extlink|= m#mailto:# && !m#amiga-news.de#;
$extlink|= m#ftp://# && !m#amiga-news.de#;
$extlink|=$cgi;
if (!$cgi) {
s#http://www.amiga-news.de/"#$home/index.html"#;
s#http://www.amiga-news.de"#$home/index.html"#;
s#http://www.amiga-news.de#$home#;
}
print "$_>";
print "$extbeg" if $extlink;
$n=index($line, ">", $i);
$i= $n>=0 ? $n : $i;
next;
}
if (m#^</a#i) {
#if ($extlink) {
# print "<img width=14 height=14 border=0 src='$home/pics/red-ball.gif'><";
#} else {
# print "<" if !$extlink;
#}
print "$extend" if $extlink;
print "<";
$extlink=0;
next;
}
print "<";
}
}